#include <iostream>
#include <vector>
using namespace std;

// 2020.01.02
class Solution
{
public:
    vector<int> twoSum(vector<int> &nums, int target)
    {
        vector<int> out;
        int tag = 0;
        int n = nums.size();
        for (int i = 0; i < n - 1; i++)
        {
            for (int j = i + 1; j < n; j++)
            {
                if ((nums[i] + nums[j]) == target)
                {
                    out.push_back(i);
                    out.push_back(j);
                    tag = 1;
                }
            }
            if (tag == 1)
                break;
        }
        return out;
    }
};

int main()
{
    vector<int> nums1, out1;
    int target1, n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        nums1.push_back(x);
    }
    cin >> target1;
    Solution S;
    out1 = S.twoSum(nums1, target1);
    for (int i = 0; i < out1.size(); i++)
    {
        cout << out1[i] << endl;
    }
    return 0;
}